package com.cssy.xxkj.basic.dao.impl;

import com.cssy.xxkj.basic.dao.BasicSyEnumDAO;
import com.cssy.xxkj.basic.entity.BasicSyEnumDO;
import com.plat.helper.SearchConditions;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

/**
 * 数据访问对象实现类
 * @since 2014-09-25
 */
public class BasicSyEnumDAOImpl extends SqlMapClientDaoSupport implements BasicSyEnumDAO {

    /**
     * 插入数据
     * @param basicSyEnumDO
     * @return 插入数据的主键
     */
    public String insertBasicSyEnumDO(BasicSyEnumDO basicSyEnumDO) {
        Object ID = getSqlMapClientTemplate().insert("BasicSyEnum.insert", basicSyEnumDO);
        return (String) ID;
    }

    /**
     * 统计记录数
     * @param basicSyEnumDO
     * @return 查出的记录数
     */
    public Integer countBasicSyEnumDOByExample(BasicSyEnumDO basicSyEnumDO) {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("BasicSyEnum.countByDOExample", basicSyEnumDO);
        return count;
    }

    /**
     * 更新记录
     * @param basicSyEnumDO
     * @return 受影响的行数
     */
    public Integer updateBasicSyEnumDO(BasicSyEnumDO basicSyEnumDO) {
        int result = getSqlMapClientTemplate().update("BasicSyEnum.update", basicSyEnumDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param basicSyEnumDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<BasicSyEnumDO> findListByExample(BasicSyEnumDO basicSyEnumDO) {
        List<BasicSyEnumDO> list = getSqlMapClientTemplate().queryForList("BasicSyEnum.findListByDO", basicSyEnumDO);
        return list;
    }

    /**
     * 根据主键获取basicSyEnumDO
     * @param id
     * @return basicSyEnumDO
     */
    public BasicSyEnumDO findBasicSyEnumDOByPrimaryKey(String id) {
        BasicSyEnumDO basicSyEnumDO = (BasicSyEnumDO) getSqlMapClientTemplate().queryForObject("BasicSyEnum.findByPrimaryKey", id);
        return basicSyEnumDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteBasicSyEnumDOByPrimaryKey(String id) {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("BasicSyEnum.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<BasicSyEnumDO> find(SearchConditions scs)
			throws DataAccessException {
		List<BasicSyEnumDO> list = getSqlMapClientTemplate().queryForList("BasicSyEnum_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().queryForObject("BasicSyEnum_ex.count", scs);
        return rows;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer rows = (Integer) getSqlMapClientTemplate().queryForObject("BasicSyEnum_ex.deleteBizRemoved", id);
        return rows;
	}

}